home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ASME's Mechanical Engine…ing Toolkit 1997 December
/
ASME's Mechanical Engineering Toolkit 1997 December.iso
/
cad_gen
/
irit4not.txt
< prev
next >
Wrap
Text File
|
1994-05-14
|
5KB
|
208 lines
DISCLAIMER
==========
I make no warranty of any kind, express or implied, including without
limitation, any warranties of merchantability and/or fitness for a particular
purpose. I shall not be liable for any damages, whether direct, indirect,
special or consequential arising from a failure of this program to operate in
the manner desired by the user. I shall not be liable for any damage to data
or property which may be caused directly or indirectly by the use of this
program.
IN NO EVENT WILL I BE LIABLE TO YOU FOR ANY DAMAGES, INCLUDING ANY LOST
PROFITS, LOST SAVINGS OR OTHER INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF YOUR USE OR INABILITY TO USE THE PROGRAM, OR FOR ANY CLAIM BY ANY
OTHER PARTY.
When you decide to use this package, you automatically agree for the
following conditions:
1. I hold copyrights for these sources, and my name must be left intact, even
if only part of source file is used.
2. The sources can be used to create any new software which if redistributed
will be redistributed FREE only (as IRIT executable). You dont have to
release your sources, but if you do, they must be free as well.
3. No part of the sources, will be used for commercial purposes.
4. All the sources here can be redistributed FREE only, and exactly as they
are provided to you - the exact same files. You may alter the archive
program if you prefer (i.e. to zoo format for example), but thats it!
5. Although stated in 4, you may charge for the distribution reasonable amount
of money (not more that $10).
I decided to release these sources, mainly for educational purposes. Many
peoples point out, they can learn from the sources, so here is your chance.
I certainly would like to see this set of programs continue to expand
in two main direction:
1. Improving and/or fixing problems/bugs.
2. Porting these set of program to different environments.
Gershon Elber
Email: gershon@cs.technion.ac.il
mail: Computer Science Department
Technion, Israel Institute of Technology
Haifa 32000
Israel
-----------------------------
The following is the file: coding.std
These are the coding standards I am using. If you make some changes to the
code, please attempt to follow these rules.
Gershon Elber
gershon@cs.technion.ac.il
------------------------------------------------------------------------------
GENERAL
-------
Code should not exceed column 80. If the code is going to "look"
better with more that 80 columns it is allowed but should be restricted
as possible.
NESTING
-------
Nesting of all expressions is by 4 spaces. Tabs used are 8 spaces.
COMMENTS
--------
Function comments will have the following form:
SPACES
------
No spaces are allowed after '(' and before ')' in a function call
or math expression. However, spaces are allowed between arguments after
the comma or between operations:
sin(x);
function1(x, y, z);
x + 5 * sin(y);
/*****************************************************************************
* Comment body. *
*****************************************************************************/
Internal comments will be aligned to the right to column 80 if the
are commenting expression in the same line:
i %= 2; /* Is i even? */
Comments that explains the following block, will be left aligned as
the block. The comment does not need to be right aligned to column 80 as
well:
/* This is a comment for the next line. */
i %= 2;
BLOCKS
------
Blocks starts with '{' and ends with '}'. If the block is beginning
of procedure then it will start with '{' at column 1 and end at column
1 with '}'. Otherwise it will start with some expression as for/if/while
etc. in the nesting form:
expression {
.
.
.
}
FOR
---
for (x = 0; x < 10; x++)
or
for (x = 0, i = 1;
x < 5;
x++, i--)
The body of the for loop can never be in the same line where the ')'
is. The ')' will be followed by '{' and the body will start in the next
line nested 4 space deapper:
for (....)
x = sin(j);
or
for (....) {
x = y / j;
y = j + 2;
}
WHILE
-----
while (x > 0)
x--; /* Use x = 0 stupid! */
or
while (x > 0 && y > 0) {
x -= 4;
y -= 4;
}
or
while (x > 0 &&
x < 5)
x /= 2;
IF
--
if (x > 0)
x = -x;
or
if (x > 0 && y > 0) {
x = -x;
y = -y;
}
or
if (x > 0)
x = -x;
else
x /= 2;
or
if (x > 0)
x = -x;
else if (x < -100)
x /= 20;
else
x /= 2;
Note that if the if expression has else part both bodies will be
aligned 4 space deep (The body of the if part can not be in same line
as the if and must be aligned with the else body).
SWITCH
------
switch (i) {
case 1:
printf("1");
break;
case 2:
printf("2");
break;
case 3:
printf("3");
break;
default:
printf("Too big");
break;
}